package org.example.test;

/**
 * @version 1.0.0
 * @author: lynn
 * @description: 懒加载单例
 * @date: 2021/7/28 19:32
 */
public class LasySingleton {

    private LasySingleton(){};

    private volatile static LasySingleton lasySingleton=null;

    public  static  LasySingleton getInstance(){
        if(lasySingleton==null){
            synchronized(LasySingleton.class){
                if (lasySingleton==null){
                    lasySingleton=new LasySingleton();
                }
            }
        }
        return lasySingleton;
    }
}
